<template>
  <div id="app">
    <header class="head">
      <a class="back tl" href="javascript:history.back(-1)">
        <i class="el-icon-arrow-left"></i>
      </a>
      <a href="javascript:;" class="tc">
        <small class="font_18 co_f">房产档案</small>
      </a>
    </header>
    <main>
        <section class="item-title">
          搜索到：房产处数:<span>{{countNum}}</span> 房产面积：<span>{{countarea}}</span>
        </section>
        <section>
             <ul class="munebox">
              <li>
                 <router-link :to='{name: "HouseArchiveslist",query:{HouseArchivesListCount:this.HouseArchivesListCount,HouseArchivesListSum:this.HouseArchivesListSum.toFixed(2)}}'> 
                    <img :src="house[0].src"> 
                    <p>房产档案</p>
                 </router-link>
              </li>
              <li>
                 <router-link :to='{name: "RetailArchiveslist",query:{RetailArchivesListCount:this.RetailArchivesListCount,RetailArchivesListSum:this.LieHouseArchivesListSum.toFixed(2)}}'> 
                   <img :src="house[1].src"> 
                    <p>门市卖场档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "WareHouseArchiveslist",query:{WareHouseArchivesCount:this.WareHouseArchivesCount,WareHouseArchivesSum:this.WareHouseArchivesSum.toFixed(2)}}'> 
                   <img :src="house[2].src"> 
                    <p>仓库档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "EscrowHouseArchiveslist",query:{EscrowHouseArchivesListCount:this.EscrowHouseArchivesListCount,EscrowHouseArchivesListSum:this.EscrowHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[3].src"> 
                    <p>代管房产档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "WorkHouseArchiveslist",query:{WorkHouseArchivesListCount:this.WorkHouseArchivesListCount,WorkHouseArchivesListSum:this.WorkHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[4].src"> 
                    <p>办公场所档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "LieHouseArchiveslist",query:{LieHouseArchivesListCount:this.LieHouseArchivesListCount,LieHouseArchivesListSum:this.LieHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[5].src"> 
                    <p>闲置房产档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "PeelHouseArchiveslist",query:{PeelHouseArchivesListCount:this.PeelHouseArchivesListCount,PeelHouseArchivesListSum:this.PeelHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[6].src"> 
                    <p>剥离房产档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "OtherHouseArchiveslist",query:{OtherHouseArchivesListCount:this.OtherHouseArchivesListCount,OtherHouseArchivesListSum:this.OtherHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[7].src"> 
                    <p>其他房产档案</p>
                   </router-link>
              </li>
               <li>
                 <router-link :to='{name: "TemporaryHouseArchiveslist",query:{TemporaryHouseArchivesListCount:this.TemporaryHouseArchivesListCount,TemporaryHouseArchivesListSum:this.TemporaryHouseArchivesListSum.toFixed(2)}}'>
                   <img :src="house[8].src"> 
                    <p>无偿\临时房产档案</p>
                   </router-link>
              </li>
            </ul>
             <!-- <ul class="munebox">
                <li v-for="(item,index) in items"  :class="{underline:((((index+1)%3)==0?parseInt((index+1)/3):(parseInt((index+1)/3)+1))==(parseInt(items.length/3) + (items.length%3==0?0:1)))}" :key='item.unid'>
                     {{index}}{{item.message }}
                </li>
            </ul> -->
        </section>
    </main>
  </div>
</template>

<script type="text/ecmascript-6">
 import { mapState } from 'vuex'
 import { HouseArchivesList,LieHouseArchivesList,TemporaryHouseArchivesList,RetailArchivesList,WareHouseArchivesList,EscrowHouseArchivesList,
 WorkHouseArchivesList,PeelHouseArchivesList,OtherHouseArchivesList} from '../../api/api';
 export default {
  components: {
  },
  data() {
    return {
       HouseArchivesListCount:0,
       HouseArchivesListSum:0,//房产档案

       LieHouseArchivesListCount:0,
       LieHouseArchivesListSum:0,//闲置房产档案

       TemporaryHouseArchivesListCount:0,
       TemporaryHouseArchivesListSum:0,//无偿/临时
       
       RetailArchivesListCount:0,//门市卖场
       RetailArchivesListSum:0,

       //仓库档案
       WareHouseArchivesCount:0,
       WareHouseArchivesSum:0,

       //代管房产
       EscrowHouseArchivesListCount:0,
       EscrowHouseArchivesListSum:0,

       //办公场所
       WorkHouseArchivesListCount:0,
       WorkHouseArchivesListSum:0,

       //剥离房产
       PeelHouseArchivesListCount:0,
       PeelHouseArchivesListSum:0,
       
       //其他房产
        OtherHouseArchivesListCount:0,
        OtherHouseArchivesListSum:0



    };
  },
  computed: {
    ...mapState({
      house: state => state.managementStore.house,
    }),
    countNum:function(){
       return Number(this.HouseArchivesListCount) + Number(this.LieHouseArchivesListCount)+ Number(this.TemporaryHouseArchivesListCount)
    },
    countarea:function(){
       return Number(this.HouseArchivesListSum) + Number(this.LieHouseArchivesListSum)+ Number(this.TemporaryHouseArchivesListSum)
    },
  },
  
  methods: {
      getData() {
        //调取接口
        HouseArchivesList().then((res) => {//房产档案
           this.HouseArchivesListCount=res.viewEntries.length
           var i=0;  
           for(i in res.viewEntries){
             this.HouseArchivesListSum +=JSON.parse(res.viewEntries[i].values[10]);
          }
           return this.HouseArchivesListSum;
        });
        LieHouseArchivesList().then((res) => {//闲置房产
            var a=0;  
            this.LieHouseArchivesListCount=res.viewEntries.length
            for(a in res.viewEntries){
             this.LieHouseArchivesListSum +=JSON.parse(res.viewEntries[a].values[11]);
          }
           return this.LieHouseArchivesListSum;
        });
         TemporaryHouseArchivesList().then((res) => {//无偿\临时房产档案
           var b=0;  
           this.TemporaryHouseArchivesListCount=res.viewEntries.length
           for(b in res.viewEntries){
             this.TemporaryHouseArchivesListSum +=JSON.parse(res.viewEntries[b].values[9]);
          }
           return this.TemporaryHouseArchivesListSum;
        });
        RetailArchivesList().then((res) => {//门市卖场
           var c=0;  
           this.RetailArchivesListCount=res.viewEntries.length
           for(c in res.viewEntries){
             this.RetailArchivesListSum +=JSON.parse(res.viewEntries[c].values[11])
          }
           return this.RetailArchivesListSum;
        });
         WareHouseArchivesList().then((res) => {//门市卖场
           var d=0;  
           this.WareHouseArchivesCount=res.viewEntries.length
           for(d in res.viewEntries){
             this.WareHouseArchivesSum +=JSON.parse(res.viewEntries[d].values[10])
          }
           return this.WareHouseArchivesSum;
        });
         EscrowHouseArchivesList().then((res) => {//代管房产
           var e=0;  
           this.EscrowHouseArchivesListCount=res.viewEntries.length
           for(e in res.viewEntries){
             this.EscrowHouseArchivesListSum +=JSON.parse(res.viewEntries[e].values[11])
          }
           return this.EscrowHouseArchivesListSum;
        });
         WorkHouseArchivesList().then((res) => {//办公场所
           var f=0;  
           this.WorkHouseArchivesListCount=res.viewEntries.length
           for(f in res.viewEntries){
             this.WorkHouseArchivesListSum +=JSON.parse(res.viewEntries[f].values[11])
          }
           return this.WorkHouseArchivesListSum;
        });
         PeelHouseArchivesList().then((res) => {//剥离房产
           var g=0;  
           this.PeelHouseArchivesListCount=res.viewEntries.length
           for(g in res.viewEntries){
             this.PeelHouseArchivesListSum+=JSON.parse(res.viewEntries[g].values[9])
          }
           return this.PeelHouseArchivesListSum;
        });
        OtherHouseArchivesList().then((res) => {//其他房产
           var h=0;  
           this.OtherHouseArchivesListCount=res.viewEntries.length
           for(h in res.viewEntries){
             this.OtherHouseArchivesListSum+=JSON.parse(res.viewEntries[h].values[9])
          }
           return this.OtherHouseArchivesListSum;
        });
      },
    
  },
  mounted() {
    this.getData()
  },

}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>

</style>
